#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
@File    ：cors_register.py
@Author  ：平
@Date    ：2025/9/28 10:58 
"""
from fastapi import FastAPI
from starlette.middleware.cors import CORSMiddleware

from app.register.abstract_register import AbstractRegister


class CorsRegister(AbstractRegister):
    """
    跨域注册类
    """

    def register(self, app: FastAPI):
        app.add_middleware(
            CORSMiddleware,
            allow_origins=["*"],
            allow_credentials=True,
            allow_methods=["*"],
            allow_headers=["*"],
        )
